// 数据写入数据库
const mongoose = require('mongoose');
// 用ES6中的promise来取代mongoose中已经过时的promise
mongoose.Promise = Promise;
mongoose.connect("mongodb://localhost/wotu");
const db = mongoose.connection;
db.on("error", (err) => {
    console.error('数据库连接失败！', err)
})

db.on("open", () => {
    console.log('数据库连接成功！')
})

//  students
const User = mongoose.model("user", {
    name: String,
    password:String
})


module.exports = User;

